package com.charlotte.study.gupao.memento.editor;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.ToString;

/**
 * @author junjie.ding
 * @date 2020/3/23
 */
@Data
@AllArgsConstructor
@ToString
public class Editor {

    private String title;

    private String content;

    private String author;

    public ArticleMemento saveMemento(){
        return new ArticleMemento(title, content, author);
    }

    public void undoMemento(ArticleMemento memento){
        this.title = memento.getTitle();
        this.content = memento.getContent();
        this.author = memento.getAuthor();
    }

}
